<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <h:form id="VotingsListForm">

        <p:panel header="#{myBundle.ListVotingsTitle}">

            <p:dataTable id="datalist" value="#{votingsController.items}" var="item"
                         selectionMode="single" selection="#{votingsController.selected}"
                         rowKey="#{item.id}"
                         paginator="true"
                         rows="10"
                         rowsPerPageTemplate="10,20,30"
                         >

                <p:ajax event="rowSelect"   update="createButton viewButton editButton deleteButton"/>
                <p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton"/>

                <p:column sortBy="#{item.id}" filterBy="#{item.id}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_id}"/>
                    </f:facet>
                    <h:outputText value="#{item.id}"/>
                </p:column>
                <p:column sortBy="#{item.frage}" filterBy="#{item.frage}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_frage}"/>
                    </f:facet>
                    <h:outputText value="#{item.frage}"/>
                </p:column>
                <p:column sortBy="#{item.created}" filterBy="#{item.created}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_created}"/>
                    </f:facet>
                    <h:outputText value="#{item.created}">
                        <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                    </h:outputText>
                </p:column>
                <p:column sortBy="#{item.answer1}" filterBy="#{item.answer1}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer1}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer1}"/>
                </p:column>
                <p:column sortBy="#{item.answers1}" filterBy="#{item.answers1}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers1}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers1}"/>
                </p:column>
                <p:column sortBy="#{item.answer2}" filterBy="#{item.answer2}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer2}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer2}"/>
                </p:column>
                <p:column sortBy="#{item.answers2}" filterBy="#{item.answers2}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers2}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers2}"/>
                </p:column>
                <p:column sortBy="#{item.answer3}" filterBy="#{item.answer3}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer3}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer3}"/>
                </p:column>
                <p:column sortBy="#{item.answers3}" filterBy="#{item.answers3}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers3}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers3}"/>
                </p:column>
                <p:column sortBy="#{item.answer4}" filterBy="#{item.answer4}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer4}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer4}"/>
                </p:column>
                <p:column sortBy="#{item.answers4}" filterBy="#{item.answers4}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers4}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers4}"/>
                </p:column>
                <p:column sortBy="#{item.answer5}" filterBy="#{item.answer5}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer5}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer5}"/>
                </p:column>
                <p:column sortBy="#{item.answers5}" filterBy="#{item.answers5}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers5}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers5}"/>
                </p:column>
                <p:column sortBy="#{item.answer6}" filterBy="#{item.answer6}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer6}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer6}"/>
                </p:column>
                <p:column sortBy="#{item.answers6}" filterBy="#{item.answers6}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers6}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers6}"/>
                </p:column>
                <p:column sortBy="#{item.answer7}" filterBy="#{item.answer7}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer7}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer7}"/>
                </p:column>
                <p:column sortBy="#{item.answers7}" filterBy="#{item.answers7}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers7}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers7}"/>
                </p:column>
                <p:column sortBy="#{item.answer8}" filterBy="#{item.answer8}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answer8}"/>
                    </f:facet>
                    <h:outputText value="#{item.answer8}"/>
                </p:column>
                <p:column sortBy="#{item.answers8}" filterBy="#{item.answers8}">
                    <f:facet name="header">
                        <h:outputText value="#{myBundle.ListVotingsTitle_answers8}"/>
                    </f:facet>
                    <h:outputText value="#{item.answers8}"/>
                </p:column>
                <f:facet name="footer">
                    <div class="footer-section">
                        <p:commandButton id="createButton" icon="ui-icon-plus"   value="#{myBundle.Create}" actionListener="#{votingsController.prepareCreate}" update=":VotingsCreateForm" oncomplete="VotingsCreateDialog.show()"/>
                        <p:commandButton id="viewButton"   icon="ui-icon-search" value="#{myBundle.View}" update=":VotingsViewForm" oncomplete="VotingsViewDialog.show()" disabled="#{empty votingsController.selected}"/>
                        <p:commandButton id="editButton"   icon="ui-icon-pencil" value="#{myBundle.Edit}" update=":VotingsEditForm" oncomplete="VotingsEditDialog.show()" disabled="#{empty votingsController.selected}"/>
                        <p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{myBundle.Delete}" actionListener="#{votingsController.delete}" update=":growl,datalist" disabled="#{empty votingsController.selected}">
                            <p:confirm header="#{myBundle.ConfirmationHeader}" message="#{myBundle.ConfirmDeleteMessage}" icon="ui-icon-alert"/>
                        </p:commandButton>
                    </div>
                </f:facet>

            </p:dataTable>

        </p:panel>
        <ui:include src="/confirmation.xhtml"/>
    </h:form>

</ui:composition>